package com.hyt.it.ogt.kq.service.gov.service.impl;

import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.kq.service.gov.mapper.OfficeBreakRuleBehaviorMapper;
import com.hyt.it.ogt.kq.service.gov.model.entity.OfficeBreakRuleBehavior;
import com.hyt.it.ogt.kq.service.gov.service.IOfficeBreakRuleBehaviorService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统级与机构级违纪行为表 服务实现类
 * </p>
 *
 * @author huangyh
 * @since 2021-04-06
 */
@Service
public class OfficeBreakRuleBehaviorServiceImpl extends BaseServiceImpl<OfficeBreakRuleBehaviorMapper, OfficeBreakRuleBehavior> implements IOfficeBreakRuleBehaviorService {


    /**
     * 初始化机构违纪参数
     * @param officeId
     */
    @Override
    public void initOfficeBreakRuleBehaviorFromOffice(String officeId) {

        Integer count = this.lambdaQuery()
                .eq(OfficeBreakRuleBehavior::getOfficeId,officeId)
                .eq(OfficeBreakRuleBehavior::getDelFlag,false)
                .count();

        if (count <= 0) {
            baseMapper.initOfficeBreakRuleBehaviorFromOffice(officeId);
        }

    }

}
